#!/bin/bash

#Make client running script
echo "#!/bin/bash" > runClient.sh
echo "java -Djava.rmi.server.codebase=file:`pwd` -Djava.security.policy=client.policy ChatClientRMI \$1 `hostname`" >> runClient.sh

chmod u+x runClient.sh

#Start the registry service
rmiregistry &

#Start the server
java -Djava.rmi.server.codebase=file:`pwd` -Djava.rmi.server.hostname=`hostname` -Djava.security.policy=server.policy TaskExecutionChatServerRMI 8080

#Stop the registry service
kill %+

